﻿using System;
using System.Diagnostics;
using System.Reflection;
using AspNetCoreWeb.Config;
using AspNetCoreWeb.Models;
using AspNetCoreWeb.Mvc.Filters;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace AspNetCoreWeb.Controllers
{

    [SaveLastActivity]
    public class HomeController : Controller
    {
        private readonly ILogger<HomeController> _logger;
        private readonly MySettings _options;
        public HomeController(ILogger<HomeController> logger, MySettings options)
        {
            this._logger = logger;
            this._options = options;
        }
        public IActionResult Index()
        {
          
            var iIspath = AppContext.BaseDirectory;
            var name = typeof(HomeController).GetTypeInfo().Assembly.GetName().Name;
            _logger.LogInformation("Calling the ping action");
            return View(_options);
        }

        public IActionResult Privacy()
        {
            return View();
        }
        public IActionResult Message()
        {
            return View();
        }


        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
